package com.task.sql.schedule.common;/**
 * @ClassName : PageDomain
 * @Description :
 * @Author : liudonghai
 * @Date: 2024-09-10 11:56
 */

/**
 * @ClassName : PageDomain
 * @Description :
 * @Author : liudonghai
 * @Date: 2024-09-10 11:56
 */

import io.swagger.annotations.ApiModelProperty;

public class PageDomain {

    /***
     * 页码
     */
    @ApiModelProperty(value = "页码，1-首页")
    private Integer pageNum;

    /***
     * 页面条数
     */
    @ApiModelProperty(value = "每页数据大小")
    private Integer pageSize;

    @ApiModelProperty(hidden = true)
    private Integer limit;

    @ApiModelProperty(hidden = true)
    private Integer offset;

    public int getLimit() {
        limit = (getPageNum() - 1) * getPageSize();
        return limit;
    }

    public int getOffset() {
        offset = getPageSize();
        return offset;
    }

    public Integer getPageNum() {
        if(null == pageNum || pageNum < 1) {
            return 1;
        }
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        if(null == pageSize || pageSize < 1) {
            pageSize = 10;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
